package com.zmn.plat.services.impl.product;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.zmn.common.dto.StatusDTO;
import com.zmn.plat.model.entity.product.BaseCodeMap;
import com.zmn.plat.model.entity.product.BaseCodeMapQuery;
import com.zmn.plat.persistence.interfaces.product.BaseCodeMapDAO;
import com.zmn.plat.services.interfaces.product.BaseCodeMapService;

/**
 * 描述:BaseCodeMapServiceImpl
 *
 * @author tanghongjun
 * @since: 2018/10/16 17:56
 */
@Service
public class BaseCodeMapServiceImpl implements BaseCodeMapService {

    @Resource
    private BaseCodeMapDAO baseCodeMapDAO;

    @Override
    public BaseCodeMap findByKey(Integer mapId) {
        return baseCodeMapDAO.findByKey(mapId);
    }

    @Override
    public Integer findKeyForMax() {
        return baseCodeMapDAO.findKeyForMax();
    }

    @Override
    public List<BaseCodeMap> listPageByQuery(BaseCodeMapQuery query) {
        return baseCodeMapDAO.listPageByQuery(query);
    }

    @Override
    public List<BaseCodeMap> listByQuery(BaseCodeMapQuery query) {
        return baseCodeMapDAO.listByQuery(query);
    }

    @Override
    @Cacheable(value = "redis1h", key = "'service:basecode:cachekey:' + #p0.cacheKey")
    public List<BaseCodeMap> listByQueryOfCache(BaseCodeMapQuery query) {
        return baseCodeMapDAO.listByQuery(query);
    }

    @Override
    public List<BaseCodeMap> listAll() {
        return baseCodeMapDAO.listAll();
    }

    @Override
    public Integer countByQuery(BaseCodeMapQuery query) {
        return baseCodeMapDAO.countByQuery(query);
    }

    @Override
    public Integer updateByKey(BaseCodeMap baseCodeMap) {
        return baseCodeMapDAO.updateByKey(baseCodeMap);
    }

    @Override
    public Integer updateStatus(BaseCodeMap baseCodeMap) {
        return baseCodeMapDAO.updateStatus(baseCodeMap);
    }

    @Override
    public Integer updateStatusBatch(StatusDTO dto) {
        return baseCodeMapDAO.updateStatusBatch(dto);
    }

    @Override
    public Integer insert(BaseCodeMap baseCodeMap) {
        return baseCodeMapDAO.insert(baseCodeMap);
    }

    @Override
    public Integer deleteByKey(Integer mapId) {
        return baseCodeMapDAO.deleteByKey(mapId);
    }
}